<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>

    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>


    <title>个人信息</title>
    <link th:href="@{/css/bootstrap.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
    <link th:href="@{/css/animate.css}" rel="stylesheet"/>
    <!--<link href="../../static/css/admin.css" rel="stylesheet">-->
    <!--<link href="../../static/css/layui.css" rel="stylesheet">-->
    <link th:href="@{/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css}" rel="stylesheet"/>
    <link th:href="@{/css/style.css}" rel="stylesheet"/>

</head>

<body class="gray-bg">
<div class="row">
    <div class="col-sm-12">
        <div class="ibox float-e-margins">
            <div class="ibox-title">
                <h5>个人信息</h5>
            </div>
            <div class="ibox-content">
                <form method="POST" class="form-horizontal" id="personal_form" action="/personal/modify"
                      enctype="multipart/form-data">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">部门</label>
                        <div class="col-sm-8">
                            <input type="text" th:if="${personalUser.deptName != null}"
                                   th:value="${personalUser.deptName}" disabled="" class="form-control"/>
                            <input type="text" th:if="${personalUser.deptName == null}" disabled=""
                                   class="form-control"/>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">角色</label>

                        <div class="col-sm-8">
                            <input type="text" th:if="${personalUser.roleName != null}"
                                   th:value="${personalUser.roleName}" name="" disabled="" class="form-control"/>
                            <input type="text" th:if="${personalUser.roleName == null}" disabled=""
                                   class="form-control"/>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">姓名</label>
                        <div class="col-sm-8">
                            <input type="text" name="userName" th:if="${personalUser.userName != null}"
                                   th:value="${personalUser.userName}" class="form-control"/>
                            <input type="text" th:if="${personalUser.userName == null}" class="form-control"
                                   name="userName"/>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">邮箱</label>
                        <div class="col-sm-8">
                            <input type="text" th:if="${personalUser.email != null}" th:value="${personalUser.email}"
                                   class="form-control" name="email"/>
                            <input type="text" th:if="${personalUser.email == null}" class="form-control"
                                   name="email"/>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">手机</label>
                        <div class="col-sm-8">
                            <input type="text" th:if="${personalUser.phone != null}" th:value="${personalUser.phone}"
                                   class="form-control" name="phone"/>
                            <input type="text" th:if="${personalUser.phone == null}" class="form-control"
                                   name="phone"/>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">选择头像</label>
                        <input id="lefile" type="file" name="file" style="display:none"/>
                        <div class="input-append input-group col-sm-2 col-xs-6" style="padding-left:15px ;">
                            <input id="photoCover" type="text" name="avator" th:if="${personalUser.avator != null}"
                                   th:value="${personalUser.avator}" class="form-control input-sm" placeholder=""/>
                            <input id="photoCover" type="text" name="avator" th:if="${personalUser.avator == null}"
                                   class="form-control input-sm" placeholder=""/>
                            <span class="input-group-btn">
       				<button class="btn btn-primary btn-sm" type="button"
                            onclick="$('input[id=lefile]').click();">请选择图片</button>
      				</span>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">选择性别</label>
                        <div class="col-sm-4">
                            <div class="radio radio-info radio-inline">
                                <input type="radio" id="inlineRadio1" value="1" name="sex"
                                       th:checked="${personalUser.sex == 1}"/>
                                <label for="inlineRadio1"> 男 </label>
                            </div>
                            <div class="radio radio-info radio-inline">
                                <input type="radio" id="inlineRadio2" value="2" name="sex"
                                       th:checked="${personalUser.sex == 2}"/>
                                <label for="inlineRadio2"> 女 </label>
                            </div>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">个人爱好</label>
                        <div class="col-sm-8">
                            <!--<input type="" class="form-control" name="password"/>-->
                            <textarea class="form-control" name="favor" th:if="${personalUser.favor != null}"
                                      th:text="${personalUser.favor}"></textarea>
                            <textarea class="form-control" name="favor"
                                      th:if="${personalUser.favor == null}"></textarea>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">自我介绍</label>
                        <div class="col-sm-8">
                            <!--<input type="" class="form-control" name="password"/>-->
                            <textarea class="form-control" name="intro" th:if="${personalUser.intro != null}"
                                      th:text="${personalUser.intro}"></textarea>
                            <textarea class="form-control" name="intro"
                                      th:if="${personalUser.intro == null}"></textarea>
                            <input type="hidden" name="userId" th:value="${personalUser.userId}"/>
                        </div>
                    </div>
                    <div class="hr-line-dashed"></div>
                    <div class="form-group">
                        <div class="col-sm-4 col-sm-offset-2">
                            <input class="btn btn-primary" id="form_submit" value="更改" type="button"/>
                            <input class="btn btn-white" value="重置" type="reset"/>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script th:src="@{/js/jquery.min.js}"></script>
<script th:src="@{/js/bootstrap.min.js}"></script>


<!-- 自定义js -->
<script th:src="@{/js/content.js}"></script>
<!-- Peity -->
<script th:src="@{/js/plugins/peity/jquery.peity.min.js}"></script>

<!-- Peity -->
<script th:src="@{/js/demo/peity-demo.js}"></script>

<!-- Chosen -->
<script th:src="@{/js/plugins/chosen/chosen.jquery.js}"></script>
<script th:src="@{/js/jquery.form.js}"></script>
<script th:src="@{/js/plugins/layer/layer.min.js}"></script>

<!--<script type="text/javascript" src="http://tajs.qq.com/stats?sId=9051096" charset="UTF-8"></script>-->
<script type="text/javascript">

    $('input[id=lefile]').change(function () {
        $('#photoCover').val($(this).val());
    });

    $(function () {
        $("#form_submit").on("click", function () {
            $("#personal_form").ajaxSubmit({
                success: function (data) {
                    if (data.code == 200) {
                        layer.msg(data.msg);
                        setTimeout(function () {
                            parent.location.reload();
                            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.layer.close(index);
                        }, 1000);
                    } else {
                        layer.msg(data.msg);
                    }
                }
            });
        });
    });
</script>
<!--&lt;!&ndash;统计代码，可删除&ndash;&gt;-->
<!--<script src="../../static/js/layui.js"></script>-->
</body>

</html>
